<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
     
<p>检测数组的所有元素是否都大于输入框中指定的数字。</p>
<p>最小年龄: <input type="number" id="ageToCheck" value="18"></p>
 
    <button onclick="myFunction()">点我</button>
	
<p>是否所有年龄都符号条件? <span id="demo"></span></p>

</body>
<script>

var ages = [32, 33, 9, 40];
function check(age){
    return document.getElementById("ageToCheck").value<=age
}
	
function myFunction(){
    document.getElementById("demo").innerHTML=ages.every(check)
}

</script>
</html>